@param info: domain info object
@param notify: send a domain created event if true
"""
- if info.getDomain() in self.domains:
+ if info.getDomid() in self.domains:
notify = False
- self.domains[info.getDomain()] = info
+ self.domains[info.getDomid()] = info
info.exportToDB(save=True)
if notify:
eserver.inject('xend.domain.create', [info.getName(),
- info.getDomain()])
+ info.getDomid()])
def _delete_domain(self, id, notify=True):
"""Remove a domain from the tables.
info.delete()
if notify:
eserver.inject('xend.domain.died', [info.getName(),
- info.getDomain()])
+ info.getDomid()])
# XXX this should not be needed
for domdb in self.dbmap.values():
if not domdb.has_key("xend"):
# Remove entries for domains that no longer exist.
# Update entries for existing domains.
for d in self.domains.values():
- info = doms.get(d.getDomain())
+ info = doms.get(d.getDomid())
if info:
d.update(info)
elif not d.restart_pending():
- self._delete_domain(d.getDomain())
+ self._delete_domain(d.getDomid())
def update_domain(self, id):
"""Update information for a single domain.
@param dominfo: domain object
"""
log.info("Restarting domain: name=%s id=%s", dominfo.getName(),
- dominfo.getDomain())
+ dominfo.getDomid())
eserver.inject("xend.domain.restart",
- [dominfo.getName(), dominfo.getDomain(), "begin"])
+ [dominfo.getName(), dominfo.getDomid(), "begin"])
try:
dominfo.restart()
log.info('Restarted domain name=%s id=%s', dominfo.getName(),
- dominfo.getDomain())
+ dominfo.getDomid())
eserver.inject("xend.domain.restart",
- [dominfo.getName(), dominfo.getDomain(),
+ [dominfo.getName(), dominfo.getDomid(),
"success"])
- self.domain_unpause(dominfo.getDomain())
+ self.domain_unpause(dominfo.getDomid())
except Exception, ex:
log.exception("Exception restarting domain: name=%s id=%s",
- dominfo.getName(), dominfo.getDomain())
+ dominfo.getName(), dominfo.getDomid())
eserver.inject("xend.domain.restart",
- [dominfo.getName(), dominfo.getDomain(), "fail"])
+ [dominfo.getName(), dominfo.getDomid(), "fail"])
return dominfo
def domain_configure(self, config):
"""
dominfo = self.domain_lookup(id)
eserver.inject('xend.domain.unpause', [dominfo.getName(),
- dominfo.getDomain()])
+ dominfo.getDomid()])
try:
- return xc.domain_unpause(dom=dominfo.getDomain())
+ return xc.domain_unpause(dom=dominfo.getDomid())
except Exception, ex:
raise XendError(str(ex))
"""
dominfo = self.domain_lookup(id)
eserver.inject('xend.domain.pause', [dominfo.getName(),
- dominfo.getDomain()])
+ dominfo.getDomid()])
try:
- return xc.domain_pause(dom=dominfo.getDomain())
+ return xc.domain_pause(dom=dominfo.getDomid())
except Exception, ex:
raise XendError(str(ex))
@param reason: shutdown type: poweroff, reboot, suspend, halt
"""
dominfo = self.domain_lookup(id)
- self.domain_restart_schedule(dominfo.getDomain(), reason, force=True)
+ self.domain_restart_schedule(dominfo.getDomid(), reason, force=True)
eserver.inject('xend.domain.shutdown', [dominfo.getName(),
- dominfo.getDomain(), reason])
+ dominfo.getDomid(), reason])
if reason == 'halt':
reason = 'poweroff'
val = dominfo.shutdown(reason)
if not dominfo.shutdown_pending:
# domain doesn't need shutdown
continue
- id = dominfo.getDomain()
+ id = dominfo.getDomid()
left = dominfo.shutdown_time_left(SHUTDOWN_TIMEOUT)
if left <= 0:
# Shutdown expired - destroy domain.
restart = (force and reason == 'reboot') or dominfo.restart_needed(reason)
if restart:
log.info('Scheduling restart for domain: name=%s id=%s',
- dominfo.getName(), dominfo.getDomain())
+ dominfo.getName(), dominfo.getDomid())
eserver.inject("xend.domain.restart",
- [dominfo.getName(), dominfo.getDomain(),
+ [dominfo.getName(), dominfo.getDomid(),
"schedule"])
dominfo.restarting()
else:
log.info('Cancelling restart for domain: name=%s id=%s',
- dominfo.getName(), dominfo.getDomain())
+ dominfo.getName(), dominfo.getDomid())
eserver.inject("xend.domain.restart",
- [dominfo.getName(), dominfo.getDomain(), "cancel"])
+ [dominfo.getName(), dominfo.getDomid(), "cancel"])
dominfo.restart_cancel()
def domain_restarts(self):
for dominfo in self.domains.values():
if not dominfo.restart_pending():
continue
- info = doms.get(dominfo.getDomain())
+ info = doms.get(dominfo.getDomid())
if info:
# Don't execute restart for domains still running.
continue
"""
dominfo = self.domain_lookup(id)
try:
- return xc.domain_pincpu(dominfo.getDomain(), vcpu, cpumap)
+ return xc.domain_pincpu(dominfo.getDomid(), vcpu, cpumap)
except Exception, ex:
raise XendError(str(ex))
"""
dominfo = self.domain_lookup(id)
try:
- return xc.bvtsched_domain_set(dom=dominfo.getDomain(),
+ return xc.bvtsched_domain_set(dom=dominfo.getDomid(),
mcuadv=mcuadv,
warpback=warpback,
warpvalue=warpvalue,
"""
dominfo = self.domain_lookup(id)
try:
- return xc.bvtsched_domain_get(dominfo.getDomain())
+ return xc.bvtsched_domain_get(dominfo.getDomid())
except Exception, ex:
raise XendError(str(ex))
"""
dominfo = self.domain_lookup(id)
try:
- return xc.sedf_domain_set(dominfo.getDomain(), period, slice,
+ return xc.sedf_domain_set(dominfo.getDomid(), period, slice,
latency, extratime, weight)
except Exception, ex:
raise XendError(str(ex))
"""
dominfo = self.domain_lookup(id)
try:
- return xc.sedf_domain_get(dominfo.getDomain())
+ return xc.sedf_domain_get(dominfo.getDomid())
except Exception, ex:
raise XendError(str(ex))
"""
dominfo = self.domain_lookup(id)
try:
- return xc.shadow_control(dominfo.getDomain(), op)
+ return xc.shadow_control(dominfo.getDomid(), op)
except Exception, ex:
raise XendError(str(ex))
dominfo = self.domain_lookup(id)
maxmem = int(mem) * 1024
try:
- return xc.domain_setmaxmem(dominfo.getDomain(),
+ return xc.domain_setmaxmem(dominfo.getDomid(),
maxmem_kb = maxmem)
except Exception, ex:
raise XendError(str(ex))
"""
dominfo = self.domain_lookup(id)
corefile = "/var/xen/dump/%s.%s.core" % (dominfo.getName(),
- dominfo.getDomain())
+ dominfo.getDomid())
try:
- xc.domain_dumpcore(dom=dominfo.getDomain(), corefile=corefile)
+ xc.domain_dumpcore(dom=dominfo.getDomid(), corefile=corefile)
except Exception, ex:
log.warning("Dumpcore failed, id=%s name=%s: %s",
- dominfo.getDomain(), dominfo.getName(), ex)
+ dominfo.getDomid(), dominfo.getName(), ex)
def instance():
"""Singleton constructor. Use this instead of the class constructor.
raise VmError('Kernel ramdisk does not exist: %s' % self.ramdisk)
if len(self.cmdline) >= MAX_GUEST_CMDLINE:
log.warning('kernel cmdline too long, domain %d',
- self.vm.getDomain())
+ self.vm.getDomid())
log.info("buildDomain os=%s dom=%d vcpus=%d", self.ostype,
- self.vm.getDomain(), self.vm.getVCpuCount())
+ self.vm.getDomid(), self.vm.getVCpuCount())
err = self.buildDomain()
if err != 0:
raise VmError('Building domain failed: ostype=%s dom=%d err=%d'
- % (self.ostype, self.vm.getDomain(), err))
+ % (self.ostype, self.vm.getDomid(), err))
def getDomainMemory(self, mem):
"""@return The memory required, in KiB, by the domain to store the
else:
console_evtchn = 0
- log.debug("dom = %d", self.vm.getDomain())
+ log.debug("dom = %d", self.vm.getDomid())
log.debug("image = %s", self.kernel)
log.debug("store_evtchn = %d", store_evtchn)
log.debug("console_evtchn = %d", console_evtchn)
log.debug("flags = %d", self.flags)
log.debug("vcpus = %d", self.vm.getVCpuCount())
- ret = xc.linux_build(dom = self.vm.getDomain(),
+ ret = xc.linux_build(dom = self.vm.getDomid(),
image = self.kernel,
store_evtchn = store_evtchn,
console_evtchn = console_evtchn,
def buildDomain(self):
# Create an event channel
- self.device_channel = channel.eventChannel(0, self.vm.getDomain())
+ self.device_channel = channel.eventChannel(0, self.vm.getDomid())
log.info("VMX device model port: %d", self.device_channel.port2)
if self.vm.store_channel:
store_evtchn = self.vm.store_channel.port2
else:
store_evtchn = 0
- log.debug("dom = %d", self.vm.getDomain())
+ log.debug("dom = %d", self.vm.getDomid())
log.debug("image = %s", self.kernel)
log.debug("control_evtchn = %d", self.device_channel.port2)
log.debug("store_evtchn = %d", store_evtchn)
log.debug("flags = %d", self.flags)
log.debug("vcpus = %d", self.vm.getVCpuCount())
- ret = xc.vmx_build(dom = self.vm.getDomain(),
+ ret = xc.vmx_build(dom = self.vm.getDomid(),
image = self.kernel,
control_evtchn = self.device_channel.port2,
store_evtchn = store_evtchn,
elif vnc:
ret = ret + ['-vnc', '-k', 'en-us']
if vnc:
- vncport = int(self.vm.getDomain()) + 5900
+ vncport = int(self.vm.getDomid()) + 5900
ret = ret + ['-vncport', '%d' % vncport]
return ret
vnc = self.vncParams()
if len(vnc):
args = args + vnc
- args = args + ([ "-d", "%d" % self.vm.getDomain(),
+ args = args + ([ "-d", "%d" % self.vm.getDomid(),
"-p", "%d" % self.device_channel.port1,
"-m", "%s" % (self.vm.getMemoryTarget() / 1024)])
args = args + self.dmargs